package com.smartleanx.module.hrm.eums.employee;


import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum EmployeeContractStatusEnum {

    UN_EXECUTED(1, "未执行"),
    IN_PROGRESS(2, "执行中"),
    EXPIRED(3, "已到期"),
    TERMINATION(4, "已终止"),

    ;

    private final Integer code;

    private final String name;


    EmployeeContractStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据code返回desc
     *
     * @param code 编号
     * @return 名称
     */
    public static String getName(Integer code) {
        for (EmployeeContractStatusEnum e : EmployeeContractStatusEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getName();
            }
        }
        return null;
    }
}
